<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>shidaiclient</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- build:css /static/lib/found.min.css -->
    <link rel="stylesheet" href="/static/lib/css/mui.css">
    <link rel="stylesheet" type="text/css" href="/static/lib/css/swiper-3.4.2.min.css"/>
    <!-- endbuild -->

    <!-- build:css /static/components/found.min.css -->
    <link rel="stylesheet" type="text/css" href="/static/components/css/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/static/components/css/found.css"/>
    <!-- endbuild -->
</head>

<body>
<div>
    <header id="header" class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"
           href="{{ url_for('home.index') }}"></a>
        <div id="search">
            <a href="{{ url_for('home.game_search') }}">
                <div id="search_child" class="iconfont icon-sousuo">
                    火柴人
                </div>
            </a>
        </div>
    </header>
    <div class="mui-content">
        <div class="swiper-container-found" id="found_banner">
            <div class="swiper-wrapper">
                <!--<div class="swiper-slide">
                        <a href="#"><img src="../static/components/img/find/find_banner_one_09.jpg" /></a>
                    </div>
                    <div class="swiper-slide">
                        <a href="#"><img src="../static/components/img/find/find_banner_two_09.jpg" /></a>
                    </div>
                    <div class="swiper-slide">
                        <a href="#"><img src="../static/components/img/find/find_banner_three_09.jpg" /></a>
                    </div>
                    <div class="swiper-slide">
                        <a href="#"><img src="../static/components/img/find/find_banner_four_09.jpg" /></a>
                    </div>-->
            </div>
            <!-- 分页器 -->
            {#            <div class="swiper-pagination" style="text-align: right;padding-right: 20px;"></div>#}
        </div>
    </div>
    <div class="found_column_title_main iconfont icon-faxian" id="found_everydayfound">
        每日新游
        <span class="found_column_title_more  mui-pull-right">查看更多</span>
    </div>
    <div class="swiper-container-column-found_one">
        <div class="swiper-wrapper" id="everydayfound">
            <!--<span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_14.png" />
                        <h3 class="everydayfound_column_title">凡人修仙传</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_16.png" />
                        <h3 class="everydayfound_column_title">最终契约</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_18.png" />
                        <h3 class="everydayfound_column_title">第7装甲师</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_20.png" />
                        <h3 class="everydayfound_column_title">最无双</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_22.png" />
                        <h3 class="everydayfound_column_title">封神召唤师</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_22.png" />
                        <h3 class="everydayfound_column_title">封神召唤师</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_mrxfx_icon_22.png" />
                        <h3 class="everydayfound_column_title">封神召唤师</h3>
                    </a>
                    <h3 class="everydayfound_download iconfont icon-xiazai">下载</h3>
                </span>-->
        </div>
    </div>
    <!--分割线-->
    <div class="found_item_cut_off_line" id="found_newgameorder_line"></div>
    <div class="found_column_title_main iconfont icon-shijian" id="found_newgameorder">
        最近更新
        <span class="found_column_title_more  mui-pull-right">查看更多</span>
    </div>
    <div class="swiper-container-column-found_two">
        <div class="swiper-wrapper" id="newgameorder">
            <!--<span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_xyyy_icon_48.png" />
                        <h3 class="newgameorder_column_title">紫青双剑</h3>
                    </a>
                    <h3 class="newgameorder_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_xyyy_icon_49.png" />
                        <h3 class="newgameorder_column_title">召唤三国</h3>
                    </a>
                    <h3 class="newgameorder_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_xyyy_icon_50.png" />
                        <h3 class="newgameorder_column_title">少年驱魔教团</h3>
                    </a>
                    <h3 class="newgameorder_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_xyyy_icon_51.png" />
                        <h3 class="newgameorder_column_title">灵魂撕裂</h3>
                    </a>
                    <h3 class="newgameorder_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_xyyy_icon_52.png" />
                        <h3 class="newgameorder_column_title">时空王座</h3>
                    </a>
                    <h3 class="newgameorder_download iconfont icon-xiazai">下载</h3>
                </span>-->
        </div>
    </div>
    <!--分割线-->
    <div class="found_item_cut_off_line" id="found_lastestupdate_line"></div>

    <div class="found_column_title_main iconfont icon-gengxin" id="found_lastestupdate">
        小编推荐
        <span class="found_column_title_more  mui-pull-right">查看更多</span>
    </div>
    <div class="swiper-container-column-found_three">
        <div class="swiper-wrapper" id="lastestupdate">
            <!--<span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_zjgx_icon_63.png" />
                        <h3 class="lastestupdate_column_title">幻城</h3>
                    </a>
                    <h3 class="lastestupdate_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_zjgx_icon_64.png" />
                        <h3 class="lastestupdate_column_title">御剑情缘</h3>
                    </a>
                    <h3 class="lastestupdate_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_zjgx_icon_65.png" />
                        <h3 class="lastestupdate_column_title">轩辕剑3</h3>
                    </a>
                    <h3 class="lastestupdate_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_zjgx_icon_66.png" />
                        <h3 class="lastestupdate_column_title">剑雨逍遥</h3>
                    </a>
                    <h3 class="lastestupdate_download iconfont icon-xiazai">下载</h3>
                </span>
                <span class="swiper-slide">
                    <a href="#">
                        <img src="../static/components/img/find/find_zjgx_icon_67.png" />
                        <h3 class="lastestupdate_column_title">超能继承者</h3>
                    </a>
                    <h3 class="lastestupdate_download iconfont icon-xiazai">下载</h3>
                </span>-->
        </div>
    </div>

</div>

<!-- build:js /static/js/found.min.js -->
<script src="/static/lib/js/swiper-3.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/lib/js/mui.min.js"></script>
<script src="/static/components/js/util.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/lib/js/jquery.js" type="text/javascript"></script>
<!-- endbuild -->
<script src="/static/components/js/ag.js" type="text/javascript"></script>

<script>
    window.onload = function () {

        var base_url = '{{ g.api_url }}';

        var channel_code = '{{ g.channel_code }}';

        loadingAnalyze('{{ g.analyze_url }}');

        //获取发现页banner数据
        request(base_url + '/game/member/banner/' + channel_code, {
            "type": "map",
            "content": {
                "area_tag": "2",
            }
        }).done(function (data) {
            dealFoundBanner(data);
        }).fail(function () {
            console.log('found banner error');
        });


        function dealFoundBanner(json) {
            for (var found_banner_num = 0; found_banner_num < json.items.length; found_banner_num++) {
                var found_banner_container = document.getElementsByClassName('swiper-container-found');
                var div = document.createElement('div');
                div.className = 'swiper-slide';
                var a = document.createElement('a');
                var aUrl = json.items[found_banner_num].jump_url;
                a.href = isNull(aUrl) == "" ? "/" + channel_code + "/detail/" + json.items[found_banner_num].game.id : aUrl;
                var img = document.createElement('img');
                img.src = json.items[found_banner_num].cover;
                img.style.width = "3.9rem";
                var img_div = document.createElement('div');
                img_div.className = "found_banner_innertext";
                img_div.innerText = json.items[found_banner_num].game.game_name;
                a.appendChild(img);
                a.appendChild(img_div);
                div.appendChild(a);
                found_banner_container[0].children[0].appendChild(div);
            }
            //发现页banner的swiper
            var found_banner = new Swiper('.swiper-container-found', {
                direction: 'horizontal', //'horizontal',//'vertical',
                slidesPerView: 1.82,
                observer: true, //修改swiper自己或子元素时，自动初始化swiper
                observeParents: true, //修改swiper的父元素时，自动初始化swiper
                // 如果需要分页器
                //					pagination: '.swiper-pagination',
                //					autoplay: 4500,
                //					autoplayDisableOnInteraction: false, //注意此参数，默认为true
            })
        }

        //	获取发现页每日新发现数据
        //	?page=1&per_page=5
        //	page: [可选]默认值 1 是首页；传 0 表示最后一页
        //	per_page: [可选]默认值 5 每页有五条记录
        //	tag: [可选] 标签   热门:0x0008 ，推荐:0x0010，精品:0x0020，最近更新:0x0040，新游预约:0x0080，每日发现:0x0100

        request(base_url + '/game/member/game/channel/' + channel_code, {
            "type": "map",
            "content": {
                "area_tag": "256",
                "page": "1",
                "per_page": "10"
            }
        })
                .done(function (data) {
                    dealFoundEveryDayList(appfilter(data,isIOSClient()));
                })
                .fail(function () {
                    console.log('dealFoundEveryDayList error');
                });

        function dealFoundEveryDayList(json) {
            if (json.count == 0) {
                var found_everydayfound = document.getElementById('found_everydayfound');
                found_everydayfound.style.visibility = "hidden";
                return;
            }

            var found_everyday_container = document.getElementById('everydayfound');

            for (var found_everyday_num = 0; found_everyday_num < json.items.length; found_everyday_num++) {
                /*整个div*/
                var span = document.createElement('span');
                span.className = 'swiper-slide';

                var tmpHtml = '<a id="' +
                        json.items[found_everyday_num].id + //跳转页面
                        '"><img src="' +
                        json.items[found_everyday_num].icon + //图片icon
                        '"/><h3 class="everydayfound_column_title">' +
                        json.items[found_everyday_num].game_name + //主标题
                        '</h3></a><h3 class="everydayfound_download iconfont icon-xiazai" data_android_link="' +
                        getRealLink(json.items[found_everyday_num].channel_game.android_link,json.items[found_everyday_num].android_link) + //安卓链接
                        '" data_ios_link ="' +
                        getRealLink(json.items[found_everyday_num].channel_game.ios_link,json.items[found_everyday_num].ios_link) + //IOS链接
                        '" data-code ="' +
                        json.items[found_everyday_num].code + //data-code
                        '" data-id ="' +
                        localStorage.getItem('user_id') + //data-id
                        '">下载</div></div>';
                span.innerHTML = tmpHtml;
                found_everyday_container.appendChild(span);
            }

            mui('#everydayfound').on('tap', '.everydayfound_download', function () {
                //						alert('everydayfound--'+this.getAttribute('data_android_link'));
                download(this, isIOSClient(), this.getAttribute('data_ios_link'), this.getAttribute('data_android_link'));
            })
            new Swiper('.swiper-container-column-found_one', {
                direction: 'horizontal', //'horizontal',//'vertical',
                loop: false,
                slidesPerView: 4.5,
                paginationClickable: true,
                observer: true, //修改swiper自己或子元素时，自动初始化swiper
                observeParents: true, //修改swiper的父元素时，自动初始化swiper
            })
        }


        //	获取发现页新游预约数据
        //	?page=1&per_page=5
        //	page: [可选]默认值 1 是首页；传 0 表示最后一页
        //	per_page: [可选]默认值 5 每页有五条记录
        //	tag: [可选] 标签   热门:0x0008 ，推荐:0x0010，精品:0x0020，最近更新:0x0040，新游预约:0x0080，每日发现:0x0100

        request(base_url + '/game/member/game/channel/' + channel_code, {
            "type": "map",
            "content": {
                "area_tag": "128",
                "page": "1",
                "per_page": "10"
            }
        })
                .done(function (data) {
                    dealFoundNewGameList(appfilter(data,isIOSClient()));
                })
                .fail(function () {
                    console.log('dealFoundNewGameList error');
                });

        function dealFoundNewGameList(json) {
            if (json.count == 0) {
                var found_newgameorder = document.getElementById('found_newgameorder');
                found_newgameorder.style.visibility = "hidden";

                var found_newgameorder_line = document.getElementById('found_newgameorder_line');
                found_newgameorder_line.style.visibility = "hidden";

                return;
            }

            var found_newgame_container = document.getElementById('newgameorder');

            for (var found_newgameorder_num = 0; found_newgameorder_num < json.items.length; found_newgameorder_num++) {
                /*整个div*/
                var span = document.createElement('span');
                span.className = 'swiper-slide';

                var tmpHtml = '<a id="' +
                        json.items[found_newgameorder_num].id + //跳转页面
                        '"><img src="' +
                        json.items[found_newgameorder_num].icon + //图片icon
                        '"/><h3 class="newgameorder_column_title">' +
                        json.items[found_newgameorder_num].game_name + //主标题
                        '</h3></a><h3 class="newgameorder_download iconfont icon-xiazai" data_android_link="' +
                        getRealLink(json.items[found_newgameorder_num].channel_game.android_link,json.items[found_newgameorder_num].android_link) + //安卓链接
                        '" data_ios_link ="' +
                        getRealLink(json.items[found_newgameorder_num].channel_game.ios_link,json.items[found_newgameorder_num].ios_link) + //IOS链接
                        '" data-code ="' +
                        json.items[found_newgameorder_num].code + //data-code
                        '" data-id ="' +
                        localStorage.getItem('user_id') + //data-code
                        '">下载</h3>';
                span.innerHTML = tmpHtml;
                found_newgame_container.appendChild(span);
            }
            mui('#newgameorder').on('tap', '.newgameorder_download', function () {
                //						alert(this.getAttribute('data_android_link'));
                download(this, isIOSClient(), this.getAttribute('data_ios_link'), this.getAttribute('data_android_link'));
            })
            new Swiper('.swiper-container-column-found_two', {
                direction: 'horizontal', //'horizontal',//'vertical',
                loop: false,
                slidesPerView: 4.5,
                paginationClickable: true,
                observer: true, //修改swiper自己或子元素时，自动初始化swiper
                observeParents: true, //修改swiper的父元素时，自动初始化swiper
            })
        }

        //	获取发现页新游预约数据
        //	?page=1&per_page=5
        //	page: [可选]默认值 1 是首页；传 0 表示最后一页
        //	per_page: [可选]默认值 5 每页有五条记录
        //	tag: [可选] 标签   热门:0x0008 ，推荐:0x0010，精品:0x0020，最近更新:0x0040，新游预约:0x0080，每日发现:0x0100

        request(base_url + '/game/member/game/channel/' + channel_code, {
            "type": "map",
            "content": {
                "area_tag": "64",
                "page": "1",
                "per_page": "10"
            }
        })
                .done(function (data) {
                    dealFoundLastestUpdateList(appfilter(data,isIOSClient()));
                })
                .fail(function () {
                    console.log('dealFoundLastestUpdateList error');
                });

        function dealFoundLastestUpdateList(json) {
            if (json.count == 0) {
                var found_lastestupdate = document.getElementById('found_lastestupdate');
                found_lastestupdate.style.visibility = "hidden";

                var found_lastestupdate_line = document.getElementById('found_lastestupdate_line');
                found_lastestupdate_line.style.visibility = "hidden";
                return;
            }

            var found_lastestupdate_container = document.getElementById('lastestupdate');

            for (var found_lastestupdate_num = 0; found_lastestupdate_num < json.items.length; found_lastestupdate_num++) {
                /*整个div*/
                var span = document.createElement('span');
                span.className = 'swiper-slide';

                var tmpHtml = '<a id="' +
                        json.items[found_lastestupdate_num].id + //跳转页面
                        '"><img src="' +
                        json.items[found_lastestupdate_num].icon + //图片icon
                        '"/><h3 class="lastestupdate_column_title">' +
                        json.items[found_lastestupdate_num].game_name + //主标题
                        '</h3></a><h3 class="lastestupdate_download iconfont icon-xiazai" data_android_link="' +
                        getRealLink(json.items[found_lastestupdate_num].channel_game.android_link,json.items[found_lastestupdate_num].android_link) + //安卓链接
                        '" data_ios_link ="' +
                        getRealLink(json.items[found_lastestupdate_num].channel_game.ios_link,json.items[found_lastestupdate_num].ios_link) + //IOS链接
                        '" data-code ="' +
                        json.items[found_lastestupdate_num].code + //data-code
                        '" data-id ="' +
                        localStorage.getItem('user_id') + //data-code
                        '">下载</h3>';
                span.innerHTML = tmpHtml;
                found_lastestupdate_container.appendChild(span);
            }
            mui('#lastestupdate').on('tap', '.lastestupdate_download', function () {
                //						alert(this.getAttribute('data_android_link'));
                download(this, isIOSClient(), this.getAttribute('data_ios_link'), this.getAttribute('data_android_link'));
            })
            new Swiper('.swiper-container-column-found_three', {
                direction: 'horizontal', //'horizontal',//'vertical',
                loop: false,
                slidesPerView: 4.5,
                paginationClickable: true,
                observer: true, //修改swiper自己或子元素时，自动初始化swiper
                observeParents: true, //修改swiper的父元素时，自动初始化swiper
            })
        }

        //发现页图标点击
        mui('.swiper-container-column-found_one').on('tap', 'a', function () {
            //跳转到详情
            window.name = this.id;
            window.location.href = '{{ url_for('home.game_detail', game_id='') }}' + this.id;
            ;
            return false;
        })
        mui('.swiper-container-column-found_two').on('tap', 'a', function () {
            //跳转到详情
            window.name = this.id;
            window.location.href = '{{ url_for('home.game_detail', game_id='') }}' + this.id;
            ;
            return false;
        })
        mui('.swiper-container-column-found_three').on('tap', 'a', function () {
            //跳转到详情
            window.name = this.id;
            window.location.href = '{{ url_for('home.game_detail', game_id='') }}' + this.id;
            ;
            return false;
        })

        //发现页点击查看更多
        mui('div').on('tap', '.found_column_title_more', function () {
            window.location = "{{ url_for('home.game_list') }}";
            return false;
        });

        mui('body').on('tap', 'a', function () {
            document.location.href = this.href;
        });

    }
</script>


</body>

</html>